package com.wk.springboot.listener;

import org.springframework.batch.core.ItemReadListener;
import org.springframework.stereotype.Component;

/**
 * @Classname MyItemReaderListener
 * @Description 自定义ItemReaderListener
 * 可以监听reader的前后
 * 必须是core的类才可以
 * @Date 2020/3/31 10:49
 * @Author by weikai
 */
@Component
public class MyItemReaderListener implements ItemReadListener {

  @Override
  public void beforeRead(){
    System.out.println("开始读数据");
  }

  @Override
  public void afterRead(Object item)  {
    System.out.println("结束读数据");
  }

  @Override
  public void onReadError(Exception ex) {
    System.out.println("读取数据错误");
  }
}
